home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-02 | 8.3 KB | 159 lines | [TEXT/MPS ] |
- ;___________________________________________________________________________
- ; Created: Wednesday, April 21, 1993
- ; Modified: Tue, Nov 30, 1993 01:14:58
- ;
- ; File: Components.a
- ;
- ; Assembler Interface to the Macintosh Libraries
- ; Copyright Apple Computer, Inc. 1990-93
- ; All Rights Reserved
- ;
- ;___________________________________________________________________________
-
- IF &TYPE('__INCLUDINGCOMPONENTS__') = 'UNDEFINED' THEN
- __INCLUDINGCOMPONENTS__ SET 1
-
- IF &TYPE('__INCLUDINGTRAPS__') = 'UNDEFINED' THEN
- INCLUDE 'Traps.a'
- ENDIF
-
- IF &TYPE('gestaltComponentMgr') = 'UNDEFINED' THEN
- gestaltComponentMgr EQU 'cpnt'
- ENDIF
-
- kAnyComponentType EQU 0
- kAnyComponentSubType EQU 0
- kAnyComponentManufacturer EQU 0
- kAnyComponentFlagsMask EQU 0
-
- cmpWantsRegisterMessage EQU $80000000
-
- ;Component Resource Extension flags
- componentDoAutoVersion EQU 1
- componentWantsUnregister EQU 2
- componentAutoVersionIncludeFlags EQU 4
-
- ComponentDescription RECORD 0
- componentType DS.L 1 ; A unique 4-byte code indentifying the command set
- componentSubType DS.L 1 ; Particular flavor of this instance
- componentManufacturer DS.L 1 ; Vendor indentification
- componentFlags DS.L 1 ; 8 each for Component,Type,SubType,Manuf/revision
- componentFlagsMask DS.L 1 ; Mask for specifying which flags to consider in search, zero during registration
- size EQU *
- ENDR
-
- ResourceSpec RECORD 0
- resType DS.L 1 ; 4-byte code
- resId DS.W 1
- size EQU *
- ENDR
-
- ComponentResource RECORD 0
- cd DS ComponentDescription ; Registration parameters
- component DS ResourceSpec ; resource where Component code is found
- componentName DS ResourceSpec ; name string resource
- componentInfo DS ResourceSpec ; info string resource
- componentIcon DS ResourceSpec ; icon resource
- size EQU *
- ENDR
-
- ComponentResourceExtension RECORD 0
- componentVersion DS.L 1 ; version of Component
- componentRegisterFlags DS.L 1 ; flags for registration
- componentIconSuite DS.W 1 ; resource id of Icon Suite
- size EQU *
- ENDR
-
- ; Structure received by Component:
- ComponentParameters RECORD 0
- flags DS.B 1 ; call modifiers: sync/async, deferred, immed, etc
- paramSize DS.B 1 ; size in bytes of actual parameters passed to this call
- what DS.W 1 ; routine selector, negative for Component management calls
- params DS.L 1 ; actual parameters for the indicated routine
- size EQU *
- ENDR
-
-
-
- ;*******************************************************
- ;* *
- ;* APPLICATION LEVEL CALLS *
- ;* *
- ;*******************************************************
- ;* Component Instance Allocation and dispatch routines
- ;*******************************************************
-
- ; direct calls to the Components
- MACRO
- _ComponentFunctionImplemented
- MOVE.L #$0002FFFD,-(A7)
- MOVEQ #$00,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _GetComponentVersion
- MOVE.L #$0000FFFC,-(A7)
- MOVEQ #$00,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- ;****************************************************
- ;* *
- ;* CALLS MADE BY Components *
- ;* *
- ;******************************************************
- ;******************************************************
- ;* Required Component routines
- ;******************************************************
- kComponentOpenSelect EQU -1 ; ComponentInstance for this open
- kComponentCloseSelect EQU -2 ; ComponentInstance for this close
- kComponentCanDoSelect EQU -3 ; selector # being queried
- kComponentVersionSelect EQU -4 ; no params
- kComponentRegisterSelect EQU -5 ; no params
- kComponentTargetSelect EQU -6 ; ComponentInstance for top of call chain
- kComponentUnregisterSelect EQU -7 ; no params
-
- ;*******************************************************
- ;* Component Instance Management routines
- ;*******************************************************
-
- ; useful helper routines for convenient method dispatching
- MACRO
- _CallComponentFunction
- MOVEQ #$FF,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- MACRO
- _CallComponentFunctionWithStorage
- MOVEQ #$FF,D0
- DC.W $A82A ; TB 002A
- ENDM
-
- ; Set Default Component flags
- defaultComponentIdentical EQU 0
- defaultComponentAnyFlags EQU 1
- defaultComponentAnyManufacturer EQU 2
- defaultComponentAnySubType EQU 4
- defaultComponentAnyFlagsAnyManufacturer EQU defaultComponentAnyFlags+defaultComponentAnyManufacturer
- defaultComponentAnyFlagsAnyManufacturerAnySubType EQU defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType
-
- MACRO
- _GetComponentIconSuite
- MOVEQ #$2A,D0
- DC.W $A82A ; TB 002A
- ENDM
-
-
- ; errors from component manager & components
- invalidComponentID EQU -3000
- validInstancesExist EQU -3001
- componentNotCaptured EQU -3002
- componentDontRegister EQU -3003
-
- badComponentInstance EQU $80008001
- badComponentSelector EQU $80008002
-
-
- ENDIF ; ...already included